﻿using Lee.Models.Entities;
using Lee.Utility.Models;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders; 

namespace Lee.EF.ModelConfigurations
{
    internal class Biz_CouponsConfiguration : IEntityTypeConfiguration<Biz_Coupons>
    {
        public void Configure(EntityTypeBuilder<Biz_Coupons> entity)
        {
            entity.HasKey(e => e.Id).HasName("PRIMARY");
            entity.ToTable("Biz_Coupons");
            entity.Property(x => x.Id).ValueGeneratedOnAdd();//id自增
            entity.Property(x => x.Name).HasMaxLength(200);
            entity.Property(x => x.Owner).HasMaxLength(100).IsConcurrencyToken();
            entity.Property(x => x.Description).HasMaxLength(200); 
   
            //mock一条数据
            entity.HasData(new Biz_Coupons()
            {
                Id= 1,
                Name = "满减券",
                Description = "满减券",
                Owner="lee",
                CreateTime= DateTime.Now,
            });
        }
    }
}
